package com.fzk.blog.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fzk.blog.bean.DicValue;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author fzk
 * @date 2021-08-20 22:42
 */
public interface DicValueMapper extends BaseMapper<DicValue> {
    @Update("update tbl_dic_value set flag=1,edit_by=#{loginId} WHERE dic_type_id=#{typeId} and flag=0")
    int logicalDeleteByTypeId(int typeId, int loginId);

    @Update("update tbl_dic_value set flag=1,edit_by=#{loginId} WHERE id=#{id} and flag=0")
    int logicalDeleteById(int id, int loginId);

    @Select("select * from tbl_dic_value where flag=0 and dic_type_id=#{dicTypeId} and name=#{name}")
    List<DicValue> selectByName(String name, Integer dicTypeId);

}
